package com.plian.system.wrapper.pf;

import com.plian.system.dto.pf.BaseBusinessAuditDTO;
import com.plian.system.entity.pf.BaseBusinessAudit;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.pf.BaseBusinessAuditVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface BaseBusinessAuditWrapper extends BaseWrapper<BaseBusinessAudit, BaseBusinessAuditDTO, BaseBusinessAuditVO> {


    @Override
    @Mappings(value = {
            @Mapping(source = "fillingUnitId", target = "fillingUnitName", qualifiedByName = ORG_ID_TO_NAME),
            @Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "approvedUser", target = "approvedUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "auditUser", target = "auditUserName", qualifiedByName = USER_ID_TO_NAME)
    })
    BaseBusinessAuditVO entityToVO(BaseBusinessAudit entity);
}
